var logger = require('pomelo-logger').getLogger(__filename);
var pomelo = require('pomelo');

var consts = require('../consts/consts');
var async = require('async');
var utils = require('../util/utils');
var consts = require('../consts/consts');

var userDao = module.exports;


userDao.getPlayer = function(userId, cb){
	logger.info('lxftest 正在从数据库获取该玩家数据 ',userId);
	var sql = 'select * from Player where userId = ?';
	var args = [userId];

	pomelo.app.get('dbclient').query(sql,args,function(err, res){
		if(err !== null){
			utils.invokeCallback(cb, err.message, null);
		} else if (!res || res.length <= 0){
			utils.invokeCallback(cb,null,[]);
		} else{
			utils.invokeCallback(cb,null, res);
		}
	});
};

